<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>MOXI</title>
    <!-- 页面管理页面  -->

    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet" />
    <link th:href="@{/font-awesome/css/font-awesome.css}" rel="stylesheet" />
    <link th:href="@{/css/style.css}" rel="stylesheet" />

    <link th:href="@{/css/plugins/iCheck/custom.css}" rel="stylesheet"/>
    <link th:href="@{/css/plugins/footable/footable.core.css}" rel="stylesheet"/>

</head>

<body>

<div id="wrapper">
    <nav class="navbar-default navbar-static-side" role="navigation" th:include="nav :: navigation"></nav>
    <div id="page-wrapper" class="gray-bg">
        <div class="border-bottom" th:include="header :: headerTop"></div>
        <div class="row wrapper border-bottom white-bg page-heading" th:fragment="headerNav">
            <div class="col-lg-10">
                <h2>用户管理</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="#">首页</a>
                    </li>
                    <li>
                        <a>商品管理</a>
                    </li>
                    <li class="active">
                        <strong>用户管理</strong>
                    </li>
                </ol>
            </div>
            <div class="col-lg-2">
            </div>
        </div>

        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>搜索&amp;操作</h5>
                            <div class="ibox-tools">
                                <a class="collapse-link">
                                    <i class="fa fa-chevron-up"></i>
                                </a>
                            </div>
                        </div>
                        <div class="ibox-content" style="display: block;">
                            <form action="userManagement">
                                <div class="row">
                                    <div class="col-sm-3 m-b-xs">
                                        <input id="userName" name="userName" placeholder="用户名" class="form-control" type="text" th:value="${admin.userName}"/>
                                    </div>
<!--                                    <div class="col-sm-2 m-b-xs">-->
<!--                                        <select name="category" id="category" class="form-control" >-->
<!--                                            <option value="0" th:selected="${news.category==0}">&#45;&#45;请选择文章分类&#45;&#45;</option>-->
<!--                                            <option th:each="nc : ${newsCategoryList}" th:value="${nc.id}" th:text="${nc.name}" th:selected="${nc.id==news.category}">分类</option>-->
<!--                                        </select>-->
<!--                                    </div>-->
<!--                                    <div class="col-sm-2 m-b-xs">-->
<!--                                        <select name="commendState" id="commendState" class="form-control">-->
<!--                                            <option value="0" th:selected="${news.commendState==0}">&#45;&#45;请选择推荐状态&#45;&#45;</option>-->
<!--                                            <option value="1" th:selected="${news.commendState==1}">正常</option>-->
<!--                                            <option value="2" th:selected="${news.commendState==2}">推荐</option>-->
<!--                                        </select>-->
<!--                                    </div>-->
<!--                                    <div class="col-sm-2 m-b-xs">-->
<!--                                        <select name="orderBy" id="orderBy" class="form-control">-->
<!--                                            <option value="ADDDATE DESC" th:selected="${news.orderBy=='ADDDATE DESC'}">时间倒序</option>-->
<!--                                            <option value="SCORE DESC" th:selected="${news.orderBy=='SCORE DESC'}">综合热度</option>-->
<!--                                            <option value="COMMENTS DESC" th:selected="${news.orderBy=='COMMENTS DESC'}">评论数</option>-->
<!--                                            <option value="BROWSES DESC" th:selected="${news.orderBy=='BROWSES DESC'}">浏览数</option>-->
<!--                                            <option value="LIKES DESC" th:selected="${news.orderBy=='LIKES DESC'}">点赞数</option>-->
<!--                                            <option value="ADDDATE ASC" th:selected="${news.orderBy=='ADDDATE ASC'}">时间正序</option>-->
<!--                                        </select>-->
<!--                                    </div>-->
                                    <div class="col-sm-2 m-b-xs">
                                        <button class="btn btn-primary btn-block" type="submit"><i class="fa fa-search"></i>&nbsp;&nbsp;&nbsp;&nbsp;<strong>搜索</strong></button>
                                    </div>
                                </div>
                            </form>
                            <div class="row">
                                <div class="col-sm-6 m-b-xs">
                                    <a th:href="@{../admin/register}" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="left" title="" data-original-title="Refresh inbox"><i class="fa fa-plus"></i>&nbsp;&nbsp;&nbsp;&nbsp;注册新用户&nbsp;&nbsp;&nbsp;&nbsp;</a>
                                </div>
                                <div class="col-sm-6 m-b-xs">
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>文章列表</h5>
                            <div class="ibox-tools">
                                <a class="collapse-link">
                                    <i class="fa fa-chevron-up"></i>
                                </a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <div class="table-responsive">
                                <table class=" table table-hover" data-page-size="10">
                                    <thead>
                                    <tr>
                                        <th width="5%">ID</th>
                                        <th width="25%">用户名 </th>
<!--                                        <th width="15%">密码</th>-->
                                        <th width="10%">真实姓名</th>
                                        <th width="10%">年龄</th>
                                        <th width="15%">电话号码</th>
                                        <th width="10%">注册时间</th>
                                        <th width="10%">更新时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr th:each="admin : ${adminList}">
                                        <td th:text="${admin.id}">Onions</td>
                                        <td th:text="${admin.userName}">Onions</td>
                                        <td th:text="${admin.realName}">Onions</td>
                                        <td th:text="${admin.age}">Onions</td>
                                        <td th:text="${admin.phoneNumber}">Onions</td>
                                        <td th:text="${admin.addDate}">Onions</td>
                                        <td th:text="${admin.updateDate}">Onions</td>
                                        <td>
                                            <a th:href="@{'newsEdit?id='+${admin.id}}" title="修改"><i class="fa fa-edit text-navy"></i></a>
                                            &nbsp;&nbsp;&nbsp;&nbsp;
                                            <a href="#" th:onclick="'javascript:updateState('+${admin.id}+',2,0);'" title="删除"><i class="fa fa-trash-o text-navy"></i></a>
                                        </td>
                                    </tr>
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="7">
                                            <ul id="pageHTML" class="pagination pull-right"></ul>
                                        </td>
                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="footer" th:include="footer :: copyright"></div>
    </div>
</div>

<!-- Mainly scripts -->
<script th:src="@{/js/jquery-2.1.1.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/js/plugins/metisMenu/jquery.metisMenu.js}"></script>
<script th:src="@{/js/plugins/slimscroll/jquery.slimscroll.min.js}"></script>

<!-- Peity -->
<script th:src="@{/js/plugins/peity/jquery.peity.min.js}"></script>

<!-- Custom and plugin javascript -->
<script th:src="@{/js/inspinia.js}"></script>
<script th:src="@{/js/plugins/pace/pace.min.js}"></script>

<!-- iCheck -->
<script th:src="@{/js/plugins/iCheck/icheck.min.js}"></script>

<!-- Peity -->
<script th:src="@{/js/demo/peity-demo.js}"></script>

<!-- FooTable -->
<script th:src="@{/js/plugins/footable/footable.all.min.js}"></script>

<!-- common -->
<script th:src="@{/js/common.js}"></script>

<script th:inline="javascript">
    var pageHTML = [[${pageHTML}]];
    $(document).ready(function () {
        $("#pageHTML").html(pageHTML);
    });

    /*<![CDATA[*/
    function updateState(id,state,commendState){
        var deleteTag;
        if(state==2){
            deleteTag = confirm("确定删除此条信息?");
        } else {
            deleteTag = true;
        }
        if(deleteTag){
            $.ajax({
                type: "POST",
                url: "newsEditState?id="+id+"&state="+state+"&commendState="+commendState,
                contentType: "application/json; charset=utf-8",
                success: function(msg){
                    window.location.reload();
                },
                error: function(){
                    alert("系统异常！");
                }
            });
        }
    }
    /*]]>*/
</script>

</body>

</html>
